#!/bin/bash
#############################################################################
# pristine.sh - restore an SVN working copy to a pristine condition.
# 
# Copyright (C) 2008 Daniel J Reidy <dubkat@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# $Id: pristine.sh 123 2008-04-12 08:59:50Z dubkat $
#############################################################################

# remove temporary files
echo "* Removing temporary files."
find . -type f -iname "*~" -delete

# delete anything that is NOT owned by the repo (except for Eclipse data files)
FILES=`svn stat | grep '?' | grep -vP '.c?project|.settings' | awk '{ print $2 }'`
FILES="${FILES} `find . -type f -iname "*.lo" -or -iname "*.la"  | grep -v '.svn'`"

echo "* Removing the following files:"
for file in $FILES; do echo "  $file"; done

sleep 5
rm -rf $FILES 2>/dev/null

echo "* done."

